{extend name="base" /}
{block name="body"}

<div class="layui-col-sm12 layui-col-md12 layui-col-lg12">
    <div class="layui-card">
        <!--搜索栏-->
        <div class="layui-form layui-card-header layuiadmin-card-header-auto">
            <form action="{:url('admin/log/index')}" class="layui-form" method="get">
                <div class="layui-form-item">
                    <label class="col-sm-4 control-label">管理员：</label>
                    <div class="layui-inline">
                        <select name="username" lay-filter="lay-select" lay-search>
                            <option value="">--全部管理员--</option>
                            {foreach name="data" item="vo"}
                            <option value="{$vo.username}" {if condition="input('username') eq $vo.username" } selected {/if} >{$vo.username}</option>
                            {/foreach}
                        </select>
                    </div>

                    <div class="layui-inline">
                        <button id="myfrom" class="layui-btn layuiadmin-btn-admin ajax-search" lay-submit
                                lay-filter="LAY-user-back-search">
                            <i class="layui-icon layui-icon-search layuiadmin-button-btn"></i>
                        </button>
                    </div>
                </div>
            </form>
        </div>

        <div class="layui-card-body">

            <!--&lt;!&ndash; 头部操作列 &ndash;&gt;-->
            <!--<div style="padding-bottom: 10px;">-->
                <!--<a href="{:url('admin/manager/del')}" class="layui-btn layui-bg-red ajax-all-delete"><i-->
                        <!--class="layui-icon layui-icon-delete"></i>删除</a>-->
            <!--</div>-->

            <!--表格主体-->
            <table id="tableList" lay-filter="tableList"></table>

            <!-- 表格操作列 -->
            <!--<script type="text/html" id="tableTBTrack">-->
                <!--{{#  if(d.role_id != 1){ }}-->
                <!--<a href="{:url('admin/manager/del')}?id={{d.id}}"-->
                   <!--class="layui-btn layui-btn-danger layui-btn-sm ajax-delete"><i-->
                        <!--class="layui-icon layui-icon-delete"></i>删除</a>-->
                <!--{{#  } }}-->
            <!--</script>-->



        </div>
    </div>
</div>

{/block}

{block name="js"}
<script>
    layui.use(['layer', 'form', 'table', 'util'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;
        var table = layui.table;
        var util = layui.util;
        var admin = layui.admin;
        var username = "{:input('username')}";
        // 渲染回访表格
        var insTb = table.render({
            elem: '#tableList',
            url: "{:url('admin/log/index')}",
            page: true,
            height: 'full-200',
            cellMinWidth: 80,
            limit: 15,
            limits: [15, 50, 100, 500, 1000, 5000, 10000, 50000, 1000000],
            size: 'lg',
            even: true,
            toolbar: true,
            title: '角色表',
            totalRow: true,
            where: {username: username},
            cols: [[
                // {type: 'checkbox'},
                {type: 'numbers', title: '#'},
                {field: 'username', sort: true, align: 'left', title: '用户名'},
                {field: 'method', align: 'left', title: '请求类型'},
                {field: 'type', align: 'left', title: '资源类型'},
                {field: 'param', align: 'left', title: '请求参数'},
                {field: 'content', align: 'left', title: '日志内容'},
                {field: 'ip', align: 'left', title: 'ip地址'},
                {field: 'url', align: 'left', title: '请求链接'},
                {field: 'useragent', align: 'left', title: '请求的工具'},
                {field: 'create_time', align: 'center', title: '时间', width: 160}
            ]],
            parseData: function (res) { //res 即为原始返回的数据
                console.log(res);
                return {
                    "code": res.code, //解析接口状态
                    "msg": res.msg, //解析提示文本
                    "count": res.data.total, //解析数据长度
                    "data": res.data.data, //解析数据列表
                };
            }
        });


    });


</script>
{/block}